<template>
    <div class="account">
        <input type="text" placeholder="输入用户名" class="account_inp" v-model="account">
        <p class="account_p">用户名只能修改一次(5-24字符之间)</p>
        <div class="account_btn" @click="yesaccount">确定修改</div>
    </div>
</template>

<script>
export default {
    name:"Account",
    methods: {
        yesaccount(){
            this.$axios.post("http://localhost:8888/login/update",{
                username:localStorage.getItem("account"),
                account:this.account
            }).then(res => {
                localStorage.setItem("account",this.account);
                console.log(res);
                this.$router.push({name:"Upload"})
            }).catch(err => console.log(err))
        }
    }
}
</script>

<style lang="less" scoped>
.account{
    width: 100%;
    height: 667px;
    box-sizing: border-box;
    background-color: #f2f2f2;
    padding: 15px;
    .account_inp{
        width: 100%;
        height: 39.38px;
        background-color: #f2f2f2;
        outline: none;
        border: 1px solid #ddd;
        padding: 2px;
        font-size: 18px;
    }
    .account_p{
        font-size: 12px;
        color: #666;
        padding: 12px 0;
    }
    .account_btn{
        width: 100%;
        height: 46.67px;
        background-color: #3190e8;
        border: none;
        margin-top: 10px;
        color: #fff;
        text-align: center;
        line-height: 46.67px;
    }
}
</style>